<!DOCTYPE html>
<html xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui">
<h:head>
	<title>OfficeStock</title>
	<link type="text/css" rel="stylesheet" href="#{request.contextPath}/css/bootstrap.css" />
	<link type="text/css" rel="stylesheet" href="#{request.contextPath}/css/main.css" />
	<script type="text/javascript" src="#{request.contextPath}/js/main.js" />
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<script>
	var offersClient = new WebSocket("ws://#{facesContext.externalContext.requestServerName}:#{facesContext.externalContext.requestServerPort}/office.stock/offers");
	
	offersClient.onmessage = function(evt) {
		console.log(evt.data);
		handleOfferNotification(evt.data);
	};
		
	offersClient.onopen = function() {
		console.log('connection opened');
	};
		
	offersClient.onclose = function(event) {
		if (event.wasClean) {
			} else {
		}
	};
		
	offersClient.onerror = function(error) {
	};
		
	window.onbeforeunload = function(e) {
		offersClient.close();
	};

	var localizedSoldMessage = "#{messages['dashboard.offer.sold']}";
	var contextPath = "#{request.contextPath}";
	</script>
</h:head>
<h:body onload="highlightCurrentPageName()">
		<div class="navbar navbar-inverse">
	    	<div class="container">
	    		 <div class="navbar-inner">
	    		 	<a class="brand" href="#">Office Stock</a>
	    		 	<p class="navbar-text pull-right">
						<a class="navbar-link" href="#{facesContext.externalContext.requestContextPath}/logout.html">#{messages['navigation.menu.logout']}</a>
					</p>
		    		<ul class="nav">
		    			<li><a id="index" href="#{facesContext.externalContext.requestContextPath}/secured/index.xhtml">#{messages['navigation.menu.home']}</a></li>
		    			<li><a id="deals" href="#{facesContext.externalContext.requestContextPath}/secured/deals.xhtml">#{messages['navigation.menu.deals']}</a></li>
		    		</ul>
	    		</div>
			</div>
		</div>    	
    	<div class="container">
	    	<ui:insert name="body">Default Body</ui:insert>
        </div>
		<!-- <footer>©
			<h:outputText value="#{session.lastAccessedTime}">
				<f:convertDateTime pattern="yyyy" type="date" />
			</h:outputText> IKhomyshyn
		</footer> -->
</h:body>
</html>